package com.lotusfall.mapper;

import com.lotusfall.pojo.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface PermissionMapper {
    /**
     * 根据UserId查询用户的权限
     * @param userid
     * @return
     */
    @Select("select p.* from tb_role_permission p join tb_role_permission rp on p.id = rp.permissionid join tb_role r on rp.roleid = r.id join tb_user_role ur on ur.roleid = r.id where ur.userid = #{userid}")
    List<Permission> listPermissionByUserId(Long userid);
}
